[pull] master from ruby:master#161
Merged
pull[bot] merged 2 commits intosysfce2:masterfrom Mar 14, 2026
Merged
Conversation
## Summary - Remove `class_attributes` and `instance_attributes` methods (zero callers) - Remove obsolete `instance_method_list` method (deprecated wrapper) - Remove memoization from `class_method_list` and `instance_methods` — these are only called once per class/module during generation, so caching adds no benefit
A better attempt of #1151 Implement `rdoc --server[=PORT]` for previewing documentation with automatic browser refresh on source file changes. The server parses all sources on startup, serves pages from memory via the Aliki generator, and watches for file modifications, additions, and deletions — re-parsing only what changed. https://github.com/user-attachments/assets/06d5ae7b-cc54-4cc5-a8b0-1cc30177cadb ## Changes - **New `RDoc::Server`** (`lib/rdoc/server.rb`) — minimal HTTP server using Ruby's built-in `TCPServer` (no WEBrick or external dependencies) - Thread-per-connection with `Connection: close` - Persistent Aliki generator instance rendering pages to strings - In-memory page cache with full invalidation on changes - Live reload via inline JS polling `/__status` endpoint every 1 second - Background file watcher polling source file mtimes every 1 second - Incremental re-parse: only changed files are re-parsed, old data removed first - Detection of new and deleted source files - **`--server[=PORT]`** CLI option (default port 4000) and `rdoc:server` Rake task - **`RDoc::Store#remove_file`** — removes a file's entries from the store hashes - **`RDoc::Store#clear_file_contributions`** — surgically removes a file's methods, constants, comments, includes, extends, and aliases from its classes/modules, preserving classes that span multiple files. Supports `keep_position:` for server re-parse to preserve comment ordering. - **`RDoc::RDoc#relative_path_for`** — extracted path normalization (against `options.root` and `options.page_dir`) shared by `parse_file` and the server - **`Darkfish#refresh_store_data`** — extracted for reuse by the server after re-parsing - **`RDoc::Servlet` → `RDoc::RI::Servlet`** — moved to clarify RI-specific usage ## Security & robustness - Binds to `127.0.0.1` only (localhost) - Path traversal protection in asset serving (`File.expand_path` containment check) - Proper HTTP error responses: 400, 404, 405, 500 - 5-second `IO.select` read timeout on client sockets - Mutex protects all store mutations, generator refresh, and cache invalidation atomically - Individual `parse_file` errors rescued so one failure doesn't block remaining files - Watcher thread uses `@running` flag with clean shutdown via `Thread#join` ## Known limitations - **Full cache invalidation:** any file change clears all cached pages. Rendering is fast (~ms per page); parsing is the expensive part and is done incrementally. - **Template/CSS changes:** require server restart (only source files are watched). --------- Co-authored-by: Sutou Kouhei <kou@clear-code.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )